package com.ws.shop.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.ws.shop.bean.Page;
import com.ws.shop.dao.OrderDao;
import com.ws.shop.entity.Order;
import com.ws.shop.service.OrderService;

@Service(value="orderService")
public class OrderServiceImpl implements OrderService {
	@Resource(name="orderDao")
	private OrderDao orderDao;

	@Transactional(propagation=Propagation.NOT_SUPPORTED,readOnly=true)
	public Page findOrderListPage(int pageno,int pagesize, String name, String start,
			String end, int aid, int type) {
		return orderDao.findOrderListPage(pageno,pagesize,name,start,end,aid,type);
	}

	@Transactional(rollbackFor=Exception.class)
	public void updateOrderState(int id, int state) {
		orderDao.updateOrderState(id,state);
	}

	@Transactional(propagation=Propagation.NOT_SUPPORTED,readOnly=true)
	public Order findOrderById(int id) {
		return orderDao.findOrderById(id);
	}
	
	public List<Order> getOrderList(final int type,final long aid,final int state ){
		return orderDao.getOrderList(type, aid, state);
	}
	
	public void mallorder(final Page page,final int type,final long uid){
		orderDao.mallorder(page, type, uid);
	}

	public void orderPayment(Page page, int type, long uid) {
		orderDao.orderPayment(page, type, uid);
	}
	
	public int clinch(final long uid,final long oid){
		return orderDao.clinch(uid, oid);
	}

	public void loseOrder(Page page, int state, long uid) {
		orderDao.loseOrder(page, state, uid);
	}

	public Order getOne(long uid, long id, int state,final int type ) {
	 
		return orderDao.getOne(uid, id, state,type);
	}
	
	public int updateOrder(final Order order){
		return orderDao.updateOrder(order);
	}
}
